﻿@page
@model EditModel
@{
    ViewData["Title"] = "Edit Product";
}

<div class="row">
    <div class="col-md-4">
        <h1>Edit Product</h1>
        <form method="post">
            <input asp-for="Product.Id" type="hidden" />
            <div class="form-group">
                <label asp-for="Product.Name"></label>
                <input asp-for="Product.Name" class="form-control" />
            </div>
            <div class="form-group">
                <label asp-for="Product.Description"></label>
                <input asp-for="Product.Description" class="form-control" />
            </div>
            <div class="form-group">
                <label asp-for="Product.Price"></label>
                <input asp-for="Product.Price" class="form-control" />
            </div>
            <div class="form-group">
                <button type="submit" class="btn btn-primary">Save</button>
                <a asp-page="./List" class="btn btn-secondary" role="button">Cancel</a>
            </div>
        </form>
    </div>
    <div class="col-md-8">
        <h1>Events</h1>
        <table class="table table-striped">
            <thead>
                <tr>
                    <th scope="col">Type</th>
                    <th scope="col">Data</th>
                    <th scope="col">Time Stamp</th>
                </tr>
            </thead>
            <tbody>
                @foreach (var evnt in Model.AggregateModel.Events)
                {
                    <tr>
                        <td>@evnt.Type</td>
                        <td>
                            @foreach (var item in evnt.Data)
                            {
                                <div><strong>@item.Key</strong> : @item.Value</div>
                            }
                        </td>
                        <td>@evnt.TimeStamp</td>
                    </tr>
                }
            </tbody>
        </table>
    </div>
</div>
